package com.jing.weibo.service.pb;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.jing.system.model.PageCls;
import com.jing.weibo.mapper.pb.PbTypeSeatMapper;
import com.jing.weibo.pojo.pb.PbTypeSeat;

/**
 * 泡吧分区位置的Service
 * @author jing.yue
 * @version 2012/09/25 1.0.0
 */
@Component
public class PbTypeSeatService {

	@Autowired
	private PbTypeSeatMapper pbTypeSeatMapper;

	/**
	 * 添加泡吧分区位置
	 * @param pbTypeSeat
	 * @throws Exception
	 */
	public void savePbTypeSeat(PbTypeSeat pbTypeSeat) throws Exception {
		pbTypeSeatMapper.savePbTypeSeat(pbTypeSeat);
	}

	/**
	 * 分页获取泡吧分区位置列表
	 * @param pbTypeSeat
	 * @return
	 * @throws Exception
	 */
	public Map<String, Object> findPbTypeSeat(PbTypeSeat pbTypeSeat) throws Exception {
		List<PbTypeSeat> pbTypeSeats = pbTypeSeatMapper.findPbTypeSeat(pbTypeSeat);
		Integer countSize = pbTypeSeatMapper.findPbTypeSeatCount(pbTypeSeat);
		PageCls pageCls = PageCls.setPageCls(pbTypeSeat.getPage(), pbTypeSeat.getSize(), null, null, countSize, pbTypeSeats.size(), pbTypeSeats);
		return pageCls.getPageInfo();
	}

	/**
	 * 根据ID获取对象
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public PbTypeSeat findByIdPbTypeSeat(Integer id) throws Exception {
		return pbTypeSeatMapper.findByIdPbTypeSeat(id);
	}

}
